import SocketServer

host = ''
port = 10000


class Handler(SocketServer.StreamRequestHandler):
    def handler(self):
        addr = self.request.getpeername()
        print "got connection from", addr
        self.wfile.write("connected")


server = SocketServer.TCPServer((host, port), Handler)
server.serve_forever()
